<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<html:html locale="true">
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title></title>
<link href="console.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
.even {
	background:	#eee;
}

.odd {

}
</style>
</head>

<body>
<jsp:include page="/title.jsp" flush="true"/>
	<p class="lnkhead2"><bean:message key="menu.messages"/>&gt;<bean:message key="menu.messageDefinitions"/>&gt;<bean:write name="message" property="id" /></p>
	<form name="form" method="post" action="message.do">
	<input type="hidden" name="act"/>
	
	<input type="hidden" name="oldId" value='<bean:write name="message" property="id"/>'/>
	<table width="723" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  
  <tr class="txtnormal2">
    <td height="32" valign="top"><div align="right"><bean:message key="message.id"/>&nbsp;</div></td>
    <td valign="top"><html:text name="message" property="id"/></td>
  </tr>
  <tr class="txtnormal2">
    <td height="68" valign="top"><div align="right"><bean:message key="heading.desc"/>&nbsp;</div></td>
    <td valign="top"><html:textarea name="message" property="desc"  cols="48" rows="4"/></td>
  </tr>
  
 
  </table>
  <table width="50%">		
			<tr >
				
				<td align="right">
					<input  type="button" name="Submit" value="<bean:message key="button.save"/>" onclick="javascript:updateMessage()"/>
				
				</td>
			</tr>
</table>
  <script type="text/javascript">

	function updateMessage(){
 		var frm = document.forms["form"];
		frm.elements["act"].value="updateMessage";
		
		 if(!checkClassName(frm.elements["id"],"<bean:message key="message.id"/>")) return;

		frm.submit();
	};
	
	
	
</script>
 
  <table width="80%">
  <tr  class="txtnormal2">
    <td height="32" valign="bottom"><div align="left"><bean:message key="message.dataList"/></div></td>
  </tr>
</table>
	  
	  <table width="70%" border="0" cellpadding="1" class="sort-table" id="table-1" cellspacing="0">
	
	<thead>
			
			<tr >
				<td align="center" width="10%" >&nbsp;</td>
				
				<td align="center" width="20%">
					
					<bean:message key="message.dataId"/>
					
				</td>
				<td align="center" width="30%">
					
					<bean:message key="heading.name"/>
					
				</td>
				
				
				<td align="center" width="20%">
					
					<bean:message key="heading.type"/>
					
				</td>
				
			<td align="center" width="20%">
					
					<bean:message key="heading.array"/>
					
				</td>

				
			</tr>
	  </thead>
			<tbody>
			<% int i=0; String color;String check="";%>
			
			<logic:iterate id="attr" name="message" property="dataList">
				
				<% i++; if(i%2==1) color="odd"; else color="even"; if(i==1) check="checked"; else check="";%>
				
				<tr  class="<%=color%>">
					<td align="center">
					<input type="radio"  name="dataId"  value="<bean:write name='attr' property='id'/>" 
					onclick="javascript:onSelected('<bean:write name='attr' property='id'/>',
					'<bean:write name='attr' property='name'/>',
					'<bean:write name='attr' property='type'/>',
					'<bean:write name='attr' property='isArray'/>')"/>
								
					</td>
					
					<td align="center">
						<bean:write name='attr' property='id'/>
					</td>
					<td align="center">
						<bean:write name='attr' property='name'/>
					</td>
					<td align="center">
						
						<bean:write name='attr' property='type'/>
					</td>
					<td align="center">
						
						<bean:write name='attr' property='isArray'/>
					</td>
		
					
				</tr>
			
			</logic:iterate>
	  </tbody>
</table>
<table width="100%">		
			<tr >
				
				<td  align="left">
					<input  type="button" name="Submit" value="<bean:message key="button.add"/>" onclick="javascript:add()"/>
					<input  type="button" name="update_button" value="<bean:message key="button.update"/>" onclick="javascript:update()" disabled="true"/>
					<input  type="button" name="del_button" value="<bean:message key="button.delete"/>" onclick="javascript:del()" disabled="true"/>
				</td>
			</tr>
			
</table>
<div id="update_div"  style="visibility:hidden; z-index:2" >
		
		<table width="70%" border="0" cellpadding="0"  cellspacing="0">
		<tr  class="txtnormal2">			
<td  align="left">ID<input type="text" name="newDataId" size="16" maxlength="36"/></td>
			<td  align="left"><bean:message key="heading.name"/><input type="text" name="dataName" size="16" maxlength="36"/></td>
				<td align="left"><bean:message key="heading.type"/><select name="dataType" size="1" > 
				<logic:iterate id="dataType" name="typelist">
<option value="<bean:write name='dataType' property='typeId'/>"> <bean:write name='dataType' property='typeName'/></option>
</logic:iterate>
                </select>
				</td>
				<td  align="left"><bean:message key="heading.array"/><input type="checkbox" name="isArray"/></td>
				<td align="right">
			<input  type="button" name="update_data_button" value="<bean:message key="button.update"/>" onclick="javascript:updateConfirm()">
			</td>
	</tr>
</table>
	</div>
</form>
<script type="text/javascript">
	
	function update()
	{
	 shift_visibility(update_div);
	 var frm = document.forms["form"];
	 frm.elements["update_data_button"].value="<bean:message key="button.update"/>";
	 frm.elements["act"].value="updateData";
	 }
	 function add()
	{
	 shift_visibility(update_div);
	 var frm = document.forms["form"];
	 frm.elements["update_data_button"].value="<bean:message key="button.add"/>";
	 frm.elements["act"].value="newData";
	 }
	 function shift_visibility(image1){
 if(image1.style.visibility == "visible")
  image1.style.visibility = "visible";
  else  image1.style.visibility = "visible";
};
	function updateConfirm()
	{
	var frm = document.forms["form"];
	if(!checkClassName(frm.elements["newDataId"],"<bean:message key="message.dataId"/>")) return;
	frm.submit();
	};
	function onSelected(dataId,dataName,dataType,isArray){
	 var frm = document.forms["form"];
	 frm.elements["update_button"].disabled = false;
	  frm.elements["del_button"].disabled = false;
	  frm.elements["newDataId"].value = dataId;
	  frm.elements["dataType"].value = dataType;
	   frm.elements["dataName"].value = dataName;
	   if(isArray=="true")  frm.elements["isArray"].checked = "true";
	   else frm.elements["isArray"].checked = "false";
	}
	function del()
	{
	var frm = document.forms["form"];
	var dataId=(selectedRadiobox(frm,"dataId"));
	if( !confirm("<bean:message key='button.confirmDelete'/>"+dataId)) return;
	frm.elements["act"].value="deleteData";
	frm.submit();
 };
 </script>
			<script type="text/javascript">
var st = new SortableTable(document.getElementById("table-1"),
	["None", "String","String"]);
	
</script>
<logic:notEmpty name="returnMsg">
	<script>
	//parent.frames[0].location.reload();
	alert('<bean:write name="returnMsg"/>');
	</script>
	</logic:notEmpty>
<%@ include file="/table_bottom.jsp" %>
</body>
</html:html>



